# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgbase=python-torrequest
pkgname=('python2-torrequest' 'python-torrequest')
_pkgname=torrequest
pkgver=0.1.0
pkgrel=7
pkgdesc='A simple interface for HTTP(s) requests over Tor.'
arch=('any')
url='https://pypi.org/project/torrequest/#files'
license=('APACHE')
makedepends=('python2-setuptools' 'python-setuptools')
source=("https://files.pythonhosted.org/packages/source/${_pkgname::1}/$_pkgname/$_pkgname-$pkgver.tar.gz")
sha512sums=('4cbb2b3b224f237990974ca73c5e601261dadbdcef5f7fe89e22352674dd5cc7179a55b5956bca23a4e84131c8af5508ae1d71ee03194b3b70f12c0f8a4734f8')

prepare() {
  cp -a "$_pkgname-$pkgver"{,-2}
}

build() {
  cd "$_pkgname-$pkgver-2"

  python2 setup.py build

  cd "$srcdir/$_pkgname-$pkgver"

  python setup.py build
}

package_python2-torrequest() {
  depends=('python2' 'python2-requests' 'python2-pysocks' 'python2-stem')

  cd "$_pkgname-$pkgver-2"

  python2 setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

package_python-torrequest() {
  depends=('python' 'python-requests' 'python-pysocks' 'python-stem')

  cd "$_pkgname-$pkgver"

  python setup.py install --prefix=/usr --root="$pkgdir" --optimize=1 \
    --skip-build
}

